import { createSlice } from '@reduxjs/toolkit'

interface InspectionState {
  inspections: any[]
  routes: any[]
  loading: boolean
  error: string | null
}

const initialState: InspectionState = {
  inspections: [],
  routes: [],
  loading: false,
  error: null,
}

const inspectionSlice = createSlice({
  name: 'inspection',
  initialState,
  reducers: {
    setInspections: (state, action) => {
      state.inspections = action.payload
    },
    setRoutes: (state, action) => {
      state.routes = action.payload
    },
  },
})

export const { setInspections, setRoutes } = inspectionSlice.actions
export default inspectionSlice.reducer